package main

import (
	"fmt"
)

//全局变量
var n10 = 100
var (
	n11 = 500
	n12 = "book"
)

func main() {
	fmt.Println("局部变量 start")
	var age int = 10
	fmt.Println("变量声明1: var age int = 10 值", age)
	fmt.Println("--------")
	var age1 int
	fmt.Println("变量声明2: var age1 int 值", age1)
	fmt.Println("--------")
	var age2 = "Tom"
	fmt.Println("变量声明3: 不写类型根据=号后面值类型判断赋值 var age2 = Tom 值", age2)
	fmt.Println("--------")
	age3 := 6
	fmt.Println("变量声明4: 省略var age3 := 6 值", age3)
	fmt.Println("--------")
	var n1, n2, n3 int
	fmt.Println("变量声明5: 声明多个变量名 var n1,n2,n3 int 值", n1, n2, n3)
	fmt.Println("--------")
	var n4, n5, n6 = 4, 5.20, "jack"
	fmt.Println("变量声明6: 声明多个变量名并赋值 var n4, n5, n6 =4,5.20,jack 值", n4, n5, n6)
	fmt.Println("--------")
	n7, n8, n9 := 74, 8.20, "cat"
	fmt.Println("变量声明7: 声明多个变量名并省略var赋值 n7, n8, n9 := 74, 8.20, cat 值", n7, n8, n9)
	fmt.Println("--------")
	fmt.Println("局部变量 end")

	fmt.Println("--------")
	fmt.Println("全局变量 start")
	fmt.Println("var n10 = 100 var (n11 = 500 n12 = book)")
	fmt.Println(n10)
	fmt.Println(n11)
	fmt.Println(n12)

	fmt.Println("全局变量 end")
}
